//
//  CollectTableViewCell.m
//  intelligent
//
//  Created by 甘世清 on 2024/2/10.
//

#import "CollectTableViewCell.h"

@implementation CollectTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)SQ_Style:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    UIView * bgView = [[UIView alloc]init];
    bgView.backgroundColor = SQColorF4F4F4;
    bgView.layer.cornerRadius = 16;
    bgView.clipsToBounds = YES;
    [self.contentView addSubview:bgView];
    [self.contentView addSubview:self.messageLabel];
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(16);
        make.left.equalTo(self.contentView).offset(28);
        make.right.equalTo(self.contentView.mas_right).offset(-28);
    }];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.messageLabel).insets(UIEdgeInsetsMake(-16, -16, -56, -16));
    }];
    
    CGFloat btnW = (SCREEN_WIDETH - 25 - 28 - 28) / 2;
    [self addSubview:self.copyBtn];
    [self.copyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bgView).offset(16);
        make.top.equalTo(bgView.mas_bottom).offset(8);
        make.width.mas_equalTo(btnW);
        make.height.mas_equalTo(36);
    }];
    
    [self addSubview:self.loveBtn];
    [self.loveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bgView).offset(-16);
        make.top.equalTo(bgView.mas_bottom).offset(8);
        make.width.mas_equalTo(btnW);
        make.height.mas_equalTo(36);
    }];
    
    self.FS_cellBottomView = self.loveBtn;
}
- (void)setModel:(MessageModel *)model{
    _model = model;
    self.messageLabel.text = model.content;
    
}

- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [[UILabel alloc]init];
        _messageLabel.font = FONT_REGULAR(14);
        _messageLabel.textColor = SQColor333333;
        _messageLabel.backgroundColor = UIColor.clearColor;
        _messageLabel.numberOfLines = 0;
//        _messageLabel.textAlignment = NSTextAlignmentRight;
    }
    return _messageLabel;
}

- (SQCustomButton *)loveBtn{
    if (!_loveBtn) {
        _loveBtn = [[SQCustomButton alloc]initType:SQCustomButtonLeftImageType imageSize:CGSizeMake(24, 24) midmargin:4];
        _loveBtn.image = SQGetImage(@"收藏");
        _loveBtn.text= SQNSLocalString(@"收藏");
        _loveBtn.textColor = SQColor333333;
        _loveBtn.font = FONT_REGULAR(14);
//        _loveBtn.SQBackimageView.image = SQGetImage(@"矩形 2");
        _loveBtn.backgroundColor = SQColor(@"#75F8F0");
        _loveBtn.layer.cornerRadius = 8;
    }
    return _loveBtn;
}

- (SQCustomButton *)copyBtn{
    if (!_copyBtn) {
        _copyBtn = [[SQCustomButton alloc]initType:SQCustomButtonLeftImageType imageSize:CGSizeMake(24, 24) midmargin:4];
        _copyBtn.image = SQGetImage(@"收藏-复制");
        _copyBtn.text= SQNSLocalString(@"复制");
        _copyBtn.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
        _copyBtn.font = FONT_REGULAR(14);
        _copyBtn.backgroundColor = SQColor(@"#000000");
        _copyBtn.layer.cornerRadius = 8;
    }
    return _copyBtn;
}

@end
